abstract class DayItem<T extends Object> {}

class DayItemOne extends DayItem {}

class DayItemTwo<T extends Object> extends DayItem<T> {
  T? data;
  WorkType? workType;
  DayItemTwo({
    this.data,
    this.workType,
  });
}

abstract interface class EnumWork {
  int get idx;
  String get _alias;
}

class EnumW implements EnumWork {
  @override
  final String _alias;

  @override
  final int idx;
  const EnumW(this.idx, this._alias);
}

extension EnumWorkName on EnumWork {
  String get name => _alias;
}

enum WorkType {
  electrician(alias: '1', grade: "20", w: EnumW(1, '1')),
  bricklayer(alias: '2', grade: "10", w: EnumW(2, '2'));

  final String alias;
  final String grade;
  final EnumW w;
  const WorkType({
    required this.alias,
    required this.grade,
    required this.w,
  });

  static WorkType byIndex(int index) {
    return WorkType.values.byIndex(index);
  }

  static WorkType byName(String name) {
    return WorkType.values.byName(name);
  }
}

extension WorkTypeName on WorkType {
  String get alias => switch (this) {
        WorkType.electrician => 'ele',
        WorkType.bricklayer => 'brick',
      };
}

extension EnumByIndex<T extends Enum> on Iterable<T> {
  T byIndex(int index) {
    for (var value in this) {
      if (value.index == index) return value;
    }
    throw ArgumentError.value(index, "index", "No enum value with that index");
  }

  Map<int, T> asIndexMap() =>
      <int, T>{for (var value in this) value.index: value};
}

class ShareConfig {
  static bool useFluwx = false;
  ShareConfig.init({bool useFluwxForAndroid = false}){
    useFluwx = useFluwxForAndroid;
  }
}